import request from '@/config/axios'


// 列表数据
export const getList = async (formdata) => {
    return await request.post({
        url: '/quake/report/template/page', data: formdata,
        headersType: "multipart/form-data", 
     })
}

// 删除列表数据
export const deleteList = async (ids) => {    
    console.log(ids);
    return await request.delete({
        url: '/quake/report/template/deleteByIds',
        data: ids
    });
};

// 查看
export const getpreview = async (previewUrl) => {   
    return await request.get({ url: `file/pdf/read?pdfPath= ${previewUrl}` })
}

// 文件类型
export const getfileType = async () => {
    return await request.get({ url: '/quake/file/type/list'})
}

// 上传模板
export const upTemplate = async (formdata) => {
    return await request.post({
        url: '/quake/report/template/create', 
        data: formdata,
        headersType: "multipart/form-data", 
    })
}

// 下载模板
// export const download = async () => {
//     return await request.get({
//         url: '/quake/report/template/download',
//     })
// }
export const downloads = async (ids) => {
    return await request.post({
        url: '/quake/report/file/downloads',
        data: ids,
        responseType: 'blob'
    });
};

// 修改
export const modify = async (formdata1) => {
    return await request.put({
        url: '/quake/report/template/update',
        data: formdata1,
        headersType: "multipart/form-data", 
    })
}


// 规则管理初始化
export const getListRule = async (pageList) => {
    return await request.post({
        url: '/quake/report/rule/page', 
        data: pageList,
        headersType: "multipart/form-data",
    }) 
}

// 删除
export const deleteListRule = async (ids) => {
    console.log(ids);
    return await request.delete({
        url: '/quake/report/rule/deleteByIds',
        data: ids
    });
};


// 报告设置
export const getDataList = async () => {
    return await request.get({
        url: '/quake/report/setting/page',
    })
}

// 修改设置
export const modifySetUp = async (setUpData) => {
    return await request.put({
        url: '/quake/report/setting/update',
        data: setUpData,
    })
}

// 上传压缩文件
export const upshpFile = async (formdata) => {
    return await request.post({
        url: '/quake/report/file/uploadShpFile',
        data: formdata,
        headersType: "multipart/form-data",
    })
}
// 列表数据
export const getLists = async () => {
    return await request.get({
        url: '/quake/report/template/list',
    })
}

// 新增报告规则
export const addReport = async (pageList) => {
    return await request.post({
        url: '/quake/report/rule/create',
        data: pageList,
        // headersType: "multipart/form-data",
    })
}

// 修改报告模板
export const update = async (pageList) => {
    return await request.put({
        url: '/quake/report/rule/update',
        data: pageList,
        // headersType: "multipart/form-data",
    })
}

export const postCityList = async (citydata) => {
    return await request.post({ url: '/quake/report/file/saveTempData', data: citydata })
}

// 模板下拉列表数据
export const gettemplatedata = async () => {
    return await request.get({ url: '/quake/report/template/list'})
}